import { MODULE_LIST } from '@/const/type';
export const tableOption = () => {
  return {
    ...window.$crudMixins.tableOptions,
    viewBtn: false,
    addBtn: true,
    editBtn: true,
    delBtn: true,
    labelWidth: 100,
    searchLabelWidth: 90,
    dialogCustomClass: 'dialog-classify',
    span: 12,
    menuWidth: 180,
    column: [
      {
        label: '任务大类',
        prop: 'module',
        row: true,
        fixed: true,
        span: 12,
        hide: true,
        type: 'select',
        rules: [
          {
            required: true,
            message: '请选择任务大类',
            trigger: 'blur',
          },
        ],
        dicData: MODULE_LIST,
        control: (val, form) => {
          if (val === '1') {
            return {
              type: {
                dicData: [{ label: '领养', value: '1' }],
              },
            };
          }
          if (val === '2') {
            return {
              type: {
                dicData: [{ label: '养宠', value: '2' }],
              },
            };
          }
          if (val === '3') {
            return {
              type: {
                dicData: [
                  {
                    label: '发动态',
                    value: '3',
                  },
                ],
              },
            };
          }
          if (val === '4') {
            return {
              type: {
                dicData: [
                  {
                    label: '设计划',
                    value: '4',
                  },
                ],
              },
            };
          }
          if (val === '5') {
            return {
              type: {
                dicData: [
                  { label: '关注', value: '5' },
                  { label: '点赞', value: '6' },
                  { label: '获赞', value: '7' },
                  { label: '收藏', value: '8' },
                  { label: '评论', value: '9' },
                  { label: '粉丝', value: '10' },
                ],
              },
            };
          }
        },
      },
      {
        label: '任务类型',
        prop: 'type',
        row: true,
        span: 12,
        type: 'select',
        search: true,
        searchType: 'select',
        dicData: [
          { label: '领养', value: '1' },
          { label: '养宠', value: '2' },
          { label: '发动态', value: '3' },
          { label: '设计划', value: '4' },
          { label: '关注', value: '5' },
          { label: '点赞', value: '6' },
          { label: '获赞', value: '7' },
          { label: '收藏', value: '8' },
          { label: '评论', value: '9' },
          { label: '粉丝', value: '10' },
          { label: '公益捐赠', value: '11' },
          { label: '云认养', value: '12' },
        ],
        // editDisabled: true,
        rules: [
          {
            required: true,
            message: '请选择任务类型',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '任务描述',
        prop: 'description',
        row: true,
        // addDisplay: false,
        // editDisplay: false,
        // viewDisplay: false,
        rules: [
          {
            required: true,
            message: '请输入任务描述',
          },
          {
            min: 1,
            max: 40,
            message: '长度不能超过40个字符',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '排序',
        prop: 'sort',
        type: 'number',
        value: 1,
        row: true,
        precision: 0,
        min: 0,
        max: 100,
        width: 100,
        rules: [
          {
            required: true,
            message: '请输入排序',
            trigger: 'blur',
          },
          {
            pattern: /^[0-9]*[1-9][0-9]*$/,
            message: '排序只能输入正整数',
          },
        ],
      },
      {
        label: '创建时间',
        prop: 'createTime',
        width: 150,
        addDisplay: false,
        editDisplay: false,
        viewDisplay: false,
      },
    ],
    // group: [
    //   {
    //     label: '说明',
    //     prop: 'remarkGroup',
    //     arrow: false,
    //     labelWidth: 0,
    //     column: [
    //       {
    //         placeholder: '请输入宠物属性说明',
    //         prop: 'remark',
    //         type: 'textarea',
    //         maxlength: 100,
    //         minRows: 7,
    //         showWordLimit: true,
    //       },
    //     ],
    //   },
    // ],
  };
};
